﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for HoaDon
/// </summary>
public class EDonDatHang
{
    private int maHD;
    private DateTime ngayLap;
    private string khachHang;
    private string nguoiNhan;
    private string tongTien;
    private string hinhThucTT;
    private DateTime ngayGiaoHang;
    private string diaChiGiaoHang;
    private string dienThoaiNN;
    private int trangThai;
    private string hinhThucGH;
    private double giamGia;
    private double soTien;


    public double SoTien
    {
        get { return soTien; }
        set { soTien = value; }
    }
    

    public double GiamGia
    {
        get { return giamGia; }
        set { giamGia = value; }
    }
    public EDonDatHang()
    { }
    public EDonDatHang(int maHD, DateTime ngayLap, string khachHang, string nguoiNhan, string tongTien, double giamGia, string hinhThucTT, string hinhThucGH, DateTime ngayGiaoHang, string diaChiGiaoHang, string dienThoaiNN, int trangThai)
    {
        this.maHD = maHD;
        this.ngayLap = ngayLap;
        this.khachHang = khachHang;
        this.nguoiNhan = nguoiNhan;
        this.tongTien = tongTien;
        this.hinhThucTT = hinhThucTT;
        this.ngayGiaoHang = ngayGiaoHang;
        this.diaChiGiaoHang = diaChiGiaoHang;
        this.dienThoaiNN = dienThoaiNN;
        this.trangThai = trangThai;
        this.hinhThucGH = hinhThucGH;
        this.giamGia = giamGia;
    }
    public int MaHD
    {
        get { return this.maHD; }
        set
        {
            if (value == null)
                throw new Exception("maHD not allow nullvalue.");
            this.maHD = value;
        }
    }
    public DateTime NgayLap
    {
        get { return this.ngayLap; }
        set
        {
            if (value == null)
                throw new Exception("ngayLap not allow nullvalue.");
            this.ngayLap = value;
        }
    }
    public string KhachHang
    {
        get { return this.khachHang; }
        set { this.khachHang = value; }
    }
    public string NguoiNhan
    {
        get { return this.nguoiNhan; }
        set { this.nguoiNhan = value; }
    }
    public string TongTien
    {
        get { return this.tongTien; }
        set { this.tongTien = value; }
    }
    public string HinhThucTT
    {
        get { return this.hinhThucTT; }
        set { this.hinhThucTT = value; }
    }
    public string HinhThucGH
    {
        get { return this.hinhThucGH; }
        set { this.hinhThucGH = value; }
    }
    public DateTime NgayGiaoHang
    {
        get { return this.ngayGiaoHang; }
        set { this.ngayGiaoHang = value; }
    }
    public string DiaChiGiaoHang
    {
        get { return this.diaChiGiaoHang; }
        set { this.diaChiGiaoHang = value; }
    }
    public string DienThoaiNN
    {
        get { return this.dienThoaiNN; }
        set { this.dienThoaiNN = value; }
    }
    public int TrangThai
    {
        get { return this.trangThai; }
        set
        {
            if (value == null)
                throw new Exception("maNV not allow nullvalue.");
            this.trangThai = value;
        }
    }
   
    public override string ToString()
    {
        return this.maHD + "; " + this.ngayLap + "; " + this.khachHang + "; " + this.nguoiNhan + "; " + this.tongTien + "; "+this.giamGia +";"+ this.hinhThucTT + "; " + this.ngayGiaoHang + "; " + this.diaChiGiaoHang + "; " + this.dienThoaiNN + "; " + this.trangThai + "; "+ this.hinhThucGH + ";";
    }
    public override bool Equals(Object obj)
    {
        EDonDatHang me = (EDonDatHang)obj;
        bool ret = this.MaHD.Equals(me.MaHD);
        return ret;
    }
    public override int GetHashCode()
    {
        return this.MaHD.GetHashCode();
    }

}

public class EDonDatHangCT
{
    private int maHD;
	private string maSP;
	private int soLuong;
	private string gia;
	private string thanhTien;
	public EDonDatHangCT()
	{}
    public EDonDatHangCT(int maHD, string maSP, int soLuong, string gia, string thanhTien)
	{
	this.maHD = maHD;
	this.maSP = maSP;
	this.soLuong = soLuong;
	this.gia = gia;
	this.thanhTien = thanhTien;
	}
	public int MaHD{
	get { return this.maHD;}
	set { if(value==null) 
		throw new Exception("maHD not allow nullvalue.");
		this.maHD=value;
	}	}
	public string MaSP{
	get { return this.maSP;}
	set { if(value==null) 
		throw new Exception("maSP not allow nullvalue.");
		this.maSP=value;
	}	}
	public int SoLuong{
	get { return this.soLuong;}
	set {this.soLuong=value;}
	}
	public string Gia{
	get { return this.gia;}
	set {this.gia=value;}
	}
	public string ThanhTien{
	get { return this.thanhTien;}
	set {this.thanhTien=value;}
	}
	public override string ToString(){
	return this.maHD+"; "+this.maSP+"; "+this.soLuong+"; "+this.gia+"; "+this.thanhTien+"; ";
	}
	public override bool Equals(Object obj)
	{
        EDonDatHangCT me = (EDonDatHangCT)obj;
	bool ret=this.MaHD.Equals(me.MaHD)&&this.MaSP.Equals(me.MaSP);
	return ret;
	}
	public override int GetHashCode()
	{
	return this.MaHD.GetHashCode()+this.MaSP.GetHashCode();
	}

}